<template>
  <div class="cart">
    <navbar class="nav-bar">
      <!-- <div slot="center">购物车({{cartLength}})</div> -->
      <div slot="center">购物车({{length}})</div>
    </navbar>

    <scroll class="wrapper" ref="scroll">
       <cart-list></cart-list>
    </scroll>
    <cart-bottom-bar></cart-bottom-bar>
  </div>
</template>

<script>
  import scroll from '../../components/common/scroll/scroll.vue'
  import navbar from '../../components/common/navbar/Navbar.vue'
  import {mapGetters} from 'vuex'
  import CartList from './childComps/CartList.vue'
  import CartBottomBar from './childComps/CartBottomBar.vue'
  export default{
    components:{
      navbar,CartList,scroll,CartBottomBar
    },
    computed:{
      // ...mapGetters([
      //   'cartLength',
      // ])

      ...mapGetters({
        length:'cartLength'
      })
    },
    activated:function(){
     this.$refs.scroll.refresh()
    },
    mounted(){
       this.$refs.scroll.refresh()
    }
  }
</script>

<style scoped="scoped">
  .nav-bar{
    background-color:pink;
    font-weight: 600;
    /* color: white; */
  }
  .cart{
    height: 100vh;
  }
  .wrapper{
    height: calc(100% - 44px - 49px - 40px);
    overflow: hidden;
  }
</style>
